type TupleToObject<T extends readonly any[]> = {
    [P in T[number]]: P;
    // [P in keyof T]: P;
};

const tuple = ["tesla", "model 3", "model X", "model Y"] as const;
type t = TupleToObject<typeof tuple>;

// 遍历数组
// T[number]

// T是数组的话 返回 [0,1,2,3]
// keyof T

// note
// 遍历union "a" | "b" --> P in "a" | "b"
// 遍历interface    keyof T
// 遍历js数组 typeof Arr ----> T ---->  P in T[Number]
